<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/2/8
 * Time: 20:36
 */
header("Content-type:JSON;charset=utf-8");  //统一输出编码为utf-8
header("Access-Control-Allow-Origin:*");//允许跨域


if($_SERVER["REQUEST_METHOD"]=="POST"){
    //post得大写
    $userpwd=$_POST["userPwd"];
    $usertel=$_POST["userTel"];
    $dpIp="127.0.0.1";
    $dbUser="root";
    $dbPwd="";
    $dbDatabase="zhiwoyaowang";
    $conn=new mysqli($dpIp,$dbUser,$dbPwd,$dbDatabase);
    mysqli_query($conn,"set names utf8");
    $sql="INSERT INTO userinfo(u_tel,u_pwd)
VALUES('".$usertel."','".$userpwd."')";
    $result=$conn->query($sql);
    $conn->close();

    $printArr=Array();
    if($result==1){
        $printArr["status"]=1;
        $printArr["msg"]="注册成功";
        print_r(json_encode($printArr));
    }else {
        $printArr["status"] = 0;
        $printArr["msg"] = "注册失败";
        print_r(json_encode($printArr));
    }
}